package com.rosense.srpingboot.handle;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.ModelAndView;

/**
 * 捕获异常错误信息
 * 
 * @author 李岩飞
 * @email eliyanfei@126.com
 * @date 2018年3月10日 下午6:11:48
 */
@ControllerAdvice
public class ExceptionHandle {

	@ExceptionHandler(value = LoginExecption.class)
	public ModelAndView noMapping(Throwable e, WebRequest request) {
		ModelAndView view = new ModelAndView();
		view.setViewName("forward:/login.html");
		return view;
	}

}
